package api

import (
	"blogdemo/gin/errmsg"
	"blogdemo/gin/model"
	"github.com/gin-gonic/gin"
	"net/http"
)

// WriteArticle 添加文章
func WriteArticle(c *gin.Context) {
	var article model.Article
	_ = c.ShouldBindJSON(&article)

	msgCode := model.CreateArticle(&article)

	c.JSON(http.StatusOK, gin.H{
		"status":  msgCode,
		"message": errmsg.GetErrMsg(msgCode),
	})
}
